package com.scorpio.goods.mapper;

import com.scorpio.common.dao.BaseDao;
import com.scorpio.goods.domain.GoodsEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 商品Mapper接口
 *
 * @author scorpio
 * @date 2021-10-29
 */
@Mapper
public interface GoodsMapper extends BaseDao<GoodsEntity> {

    GoodsEntity getById(@Param("id") Long id);

    int updateDelete(@Param("ids") Long[] ids);

    int updateGoodsNumber(@Param("id") Long id, @Param("number") String number);

    //刷新库存和价格
    int updateSoldoutAndPrice(@Param("id") Long id);

    List<GoodsEntity> appList(
            @Param("categoryId") Long categoryId
            , @Param("queryText") String queryText
            , @Param("queryType") String queryType
            , @Param("queryMinPrice") Float queryMinPrice
            , @Param("queryMaxPrice") Float queryMaxPrice
            , @Param("offset") Integer offset
            , @Param("limit") Integer limit
    );

    GoodsEntity details(@Param("id") Long id);

    int updateInventory(@Param("id")Long id,@Param("change") Integer change);

}
